Skip to content

✨[Feat] Add source-resolution scanner PDF export - #142

Open
maruson08 wants to merge 5 commits into
v2.4from
feat/v2.4-scan-to-pdf
Open

maruson08 wants to merge 5 commits into
v2.4from
feat/v2.4-scan-to-pdf

Conversation

@maruson08

@maruson08 maruson08 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Behavior

Document Scanner now creates and downloads a local PDF from the current ordered source images. Original/Grayscale/Document modes are applied at full decoded source resolution, EXIF orientation is preserved, and existing A4 auto-orientation/10-mm contain fitting is reused. The actual generated PDF is previewed with the existing local PDF.js renderer.

Dependency and review range

Depends on #141, which was still open/unmerged at preflight. Head starts at its inspected head f33acad. The requested base is v2.4, so prerequisite 24A commits appear until #141 is merged separately. Review 24B changes from that parent SHA; merge #141 first only through separate user authorization. This PR does not modify or merge #141.

Implementation

  • Adapt existing Images to PDF/jsPDF composition with optional cancellation, asynchronous conversion and PNG support; keep its existing JPEG defaults.
  • Reuse EXIF-aware decoding and scan preprocessing with 64-row strips; retain source resolution rather than embedding 1,000px previews.
  • Bound export to 12 MP/image, 24 MP total and 64 MiB output; serialize writers and guard stale progress/results. Release bitmaps, canvases, preview workers and download URLs.
  • Add progress/cancel/retry, result page navigation and download; invalidate output on source/order/appearance changes. Preserve all six locales and keyboard/mobile conventions. No new dependency, service, document persistence or CSP relaxation.

Verification

Local typecheck, compile, production build and targeted regressions passed. Real Chromium generated and parsed two four-page PDF downloads; embedded 1,200x2,000 and 2,000x1,200 images, EXIF 30x60 output, exact order and actual mode pixel values were verified. Ten result viewport/locale cases, cancellation, stale changes, writer failure/retry, budget rejection, URL cleanup and worker teardown completed.

The local full-suite HTTP gate and browser security checks correctly reject AdGuard's injected CSP/requests. Strict expectations were not relaxed. All clean hosted CI/security/browser gates passed for head 98a34f2. Physical mobile, Firefox and Edge were not tested locally.

Exact changed paths, commands/results, memory/cancellation limits and 24C follow-ups: docs/sprint-24b-scan-to-pdf.md.

No merge, tag, release or production deployment is authorized. Optional scanner OCR remains 24C and searchable-PDF adapter work remains 24D.

Final hosted verification

  • CI run 44099870243: SUCCESS. Full tests, typecheck/build/provenance, real OCR, existing PDF/Image/OCR HTTP/CSP/download verification, responsive/accessibility, original scanner and new source-resolution scanner PDF browser gates, and release artifact inspection all passed.
  • Security monitoring run 44099870307: SUCCESS. CodeQL and exact lockfile/vendor advisory checks passed.
  • Clean hosted scanner/PDF network and CSP checks passed without relaxing policy, resolving the local AdGuard verification limitation.

This PR is ready for review following successful verification; it remains unmerged and depends on #141.

@maruson08
maruson08 marked this pull request as ready for review November 17, 2026 14:12

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant